import Axios, { downLoadFile } from '@/utils/request';
import {
    InvestmentManagerStatisticDTO,
    InvestmentManagerStatisticVO,
    ProductStatisticsDTO,
    ProductStatisticsVO,
    TransfiniteIndicatorDetailDTO,
    TransfiniteIndicatorDetailVO,
} from '../vo/transfinite-Indicator';

export default class API {
    /**
     * 产品统计表格列表
     * @returns
     */
    static productStatisticsList(data: ProductStatisticsDTO): Promise<ProductStatisticsVO> {
        return Axios.post('/middle/product/statistics', data);
    }

    /**
     * 投资经理表格列表
     * @returns
     */
    static investmentManagerStatisticList(data: InvestmentManagerStatisticDTO): Promise<InvestmentManagerStatisticVO> {
        return Axios.post('/middle/investManager/statistics', data);
    }

    /**
     * 超限指标明细列表
     * @returns
     */
    static transfiniteIndicatorDetailList(data: TransfiniteIndicatorDetailDTO): Promise<TransfiniteIndicatorDetailVO> {
        return Axios.post('/middle/report/detail', data);
    }

    /**
     * 产品统计导出
     * @param data
     */
    static downLoadFileProduct(data: any) {
        downLoadFile({
            url: '/middle/product/statistics/export',
            method: 'post',
            data: data,
        });
    }
    /**
     * 投资经理统计导出
     * @param data
     */
    static downLoadFileManager(data: any) {
        downLoadFile({
            url: '/middle/investManager/statistics/export',
            method: 'post',
            data: data,
        });
    }
    /**
     * 超限指标明细导出
     * @param data
     */
    static downLoadFileTransfinite(data: any) {
        downLoadFile({
            url: '/middle/report/export',
            method: 'post',
            data: data,
        });
    }

    /**
     * 超限指标明细事件关闭
     * @param data
     */
    static reportClose(data: { overrunEventIds: string[]; closeReason: string }) {
        return Axios.post('/middle/report/close', data);
    }

    /**
     * 超限指标明细事件发起
     * @param data
     */
    static reportLaunch(data: { overrunEventIds: string[] }) {
        return Axios.post('/middle/report/launch', data);
    }

    /**
     * 超限指标明细事件删除
     * @param data
     */
    static reportDelete(data: { overrunEventIds: string[] }) {
        return Axios.post('/middle/report/delete', data);
    }
}
